import { Component, OnInit } from '@angular/core';
import { NzMessageService, NzModalRef } from 'ng-zorro-antd';
import { SFSchema } from '@delon/form';
@Component({
  selector: 'app-salary-edit',
  templateUrl: './edit.component.html',
})
export class BusinessSalaryEditComponent implements OnInit {
  i: any = {};
  accountInfo: string = '新增薪水';
  schema: SFSchema = {
    properties: {
      name: { type: 'string', title: '姓名', maxLength: 50 },
      department: {
        type: 'string',
        title: '部门',
        enum: [
          { value: '人事部', label: '人事部' },
          { value: '销售部', label: '销售部' },
          { value: '技术部', label: '技术部' },
          { value: '企划部', label: '企划部' },
          { value: '产品部', label: '产品部' }
        ]
      },
      salary: {
        type: 'string',
        title: '基本工资'
      },
      allowance: { type: 'string', title: '岗位津贴'},
    },
    required: ['name', 'department', 'salary'],
    ui: {
      spanLabelFixed: 100,
      grid: { span: 24 }
    },
  };
  constructor(private modal: NzModalRef, private msgSrv: NzMessageService) {}
  ngOnInit() {
    if(this.i._id) {
      this.accountInfo = '修改薪水'
    }
  }
  save(value: any) {
    this.modal.close(value);
  }
  close() {
    this.modal.destroy();
  }
}
